﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Convertor.Interface;
using Wpf.CommonTools.Converter;

namespace Convertor.Plugin.InputAndOutput
{
    class OperateTargetSourceConverter : IValueConverter
    {
        #region IValueConverter 成员

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return new string[] { };
            }
            OutputTypes target = (OutputTypes)value;
            if (target == OutputTypes.InputContent)
            {
                var a = Enum.GetValues(typeof(OperateInputTypes)).Cast<OperateInputTypes>().Select(v => new EnumModel
                {
                    Name = v.ToString(),
                    Value = (int)v
                });
                return a;
            }
            else
            {
                var a = Enum.GetValues(typeof(OperateOutputTypes)).Cast<OperateOutputTypes>().Select(v => new EnumModel
                {
                    Name = v.ToString(),
                    Value = (int)v
                });
                return a;
            }

        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
